import Comment from "./comment";

export default class Pointer {
  // 人物指针
  constructor(
    width = Comment.pointerSize,
    height = Comment.pointerSize,
    pointerImg = require("../../assets/pointer.gif")
  ) {
    this.width = width;
    this.height = height;
    this.pointerImg = pointerImg;
  }
  create(x, y, name) {
    let pObj = document.createElement("img");
    pObj.setAttribute("class", `pointer-${name}`);
    pObj.src = this.pointerImg;
    pObj.style.left = x - 10 + "px"; //加减 微调炸弹位置
    pObj.style.top = y - 50 + "px";
    pObj.style.position = "absolute";
    pObj.style.width = this.width + "px";
    pObj.style.height = this.height + "px";
    document.getElementById("box").appendChild(pObj);
  }
}
